
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>流程定义</title>
	<link href="../../build/common/base.css" rel="stylesheet">
	<script type="text/javascript" src="../../build/common/base.js"></script>
	<script type="text/javascript" src="../../build/common/gridList.js"></script>
	<script type="text/javascript" src="../../build/common/easyLayout.js"></script>
</head>
<body class="easy-layout">
<div data-options="region:'west',split:true,border:true,title:'分类'" style="width: 180px;">
	<div sysTreeGroup treeKey="flow" groupColumn="type_id_"></div>
</div>

<div data-options="region:'center',border:false">
	<!--搜索 .search-panel 必须 -->
	<div class="panel panel-default search-panel bbn">
		<div class="panel-heading">
			查询条件
			<a 　href="javascript:void(0)" class="pull-right">
				<i class="fa fa-angle-double-up" toggle-collapse="#searchForm"></i>
			</a>
		</div>
		<div class="panel-body">
			<form id="searchForm" class="form-horizontal">
				<div class="form-group" style="margin-right: 0px;">
					<label class="control-label col-sm-1" for="name_^VLK">流程名称</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" id="name_^VLK">
					</div>
					<label class="control-label col-sm-1" for="key_^VLK">流程KEY</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" id="key_^VLK">
					</div>
					<div class="col-sm-4" style="text-align: left;">
						<button type="button" style="margin-left: 50px" class="btn btn-primary fa-search">查询</button>
						<button type="button" style="margin-left: 50px" class="btn btn-primary fa-rotate-left">重置</button>
					</div>
				</div>
			</form>
		</div>
	</div>
	<script type="text/javascript">
        function test() {
            top.addTab({
                id : "editUserInfo",
                name : "个人信息编辑",
                icon : 'fa-info',
                closable : true
            });
        }
	</script>
	<!--grid区域  -->
	<div class="btn-group toolbar">
		<a class="btn btn-outline btn-primary fa-plus" openDialog="创建流程定义" url="definitionEdit" dialogConf="{height:435,width:720}" href="javascript:void(0)">新增 </a>
		<button class="btn btn-outline btn-primary fa-clear" qtip='清除系统所有缓存，用于数据库更新发布内容等系统无法感知数据被更新的场景' sendAction="清除系统缓存" url="/bpm/definition/clearSysCache">清除系统缓存</button>
		<a class="btn btn-outline btn-primary fa-download" href="javascript:void(0)" onclick="exportbpm()">导出 </a>
		<a class="btn btn-outline btn-primary fa-upload" openDialog="预览导入" top="true" url="bpm/overallView/overallViewUpload.html" href="javascript:void(0)">预览导入 </a>
	</div>
	<table ab-grid data-id-field="id" data-url="bpm/definition/listJson">
		<thead>
		<tr>
			<th data-checkbox="true">序号</th>
			<th data-field="name">流程名称</th>
			<th data-field="key">流程KEY</th>
			<th data-field="desc">描述</th>
			<th data-field="status" data-formatter="labelFormatter" data-value-style="deploy-已发布-primary,forbidden-禁用-warning,draft-草稿-info,">状态</th>
			<th data-field="version">版本</th>
			<th data-field="supportMobile" data-formatter="labelFormatter" data-value-style="1-支持-primary,0-不支持-info,">移动端</th>
			<th data-field="createTime" data-formatter="dateFormatter">创建时间</th>
			<th data-field="updateTime" data-formatter="dateTimeFormatter" data-visible="false">更新时间</th>
			<th data-field="id" data-formatter="innerHtmlFormatter" data-title="管理">
				<span class="fa-trash btn btn-outline  btn-primary " qtip='删除' sendAction="删除" url="/bpm/definition/remove?id={id}"></span>
				<span class="fa-user-times btn btn-outline  btn-primary " dialogConf='"height":500,"width":750' qtip='授权' openDialog="{name}-流程授权" top="true" url="/sys/authorization/authorizationDialog.html?rightsObject=FLOW&rightsTarget={key}"></span>
				<span class="fa-eye btn btn-outline btn-primary " qtip='流程全局配置预览' openDialog="流程配置全局预览【{name}】" top="true" url="/bpm/overallView/overallViewEdit.html?defId={id}"></span>
				<span class="fa-edit btn btn-outline btn-primary " qtip='流程设计' openDialog="流程设计  (流程实施方案请参考 <a href='http://www.agilebpm.cn'>www.agilebpm.cn</a> 【敏捷流程实施三步曲】)" top="true" url="/flow-editor/modeler.html?modelId={actModelId}"></span>
				<span if="'{actDefId}'" class="fa-send btn btn-outline btn-primary " iview="标记" qtip='启动' openDialog="发起申请【{name}】" top="true" url="/bpm/definition/start.html?defKey={key}"></span>
				<span if="!'{actDefId}'" class="  btn-disable " title='请完成流程设计后再启动流程！'>启动</span>
				<span class="fa-vimeo-square btn btn-outline btn-primary " qtip='版本管理' openDialog="版本管理" url="definitionVersions.html?flowKey={key}"></span>
				<!-- 测试用的,方便查看流程图 -->
				<a class='btn btn-outline btn-primary fa fa-image' qtip="流程图" opendialog="流程图" url="/bpm/instance/instanceImageDialog.html?instanceId={instId}&defId={id}&taskId={taskId}">流程图</a>


			</th>
		</tr>
		</thead>
	</table>
</div>
</body>
<script type="text/javascript">
    $(function() {
        window.setTimeout(function() {
            if ($.getParam("type") === 'iview') {
                $("[iview]").attr("title", "发起流程申请请移步至 iview版本 （切换子系统）");
                $("[iview]").attr("disabled", true)
            }
        }, 1000);
    });

    function exportbpm() {
        var ids = $.getDatagridCheckedId();
        if (!ids || ids.length === 0) {
            $.Dialog.warning("请至少选择一条流程定义！");
            return;
        }
        var url = __ctx + "/bpm/overallView/exportBpmDefinition?rand=" + Math.random() + "&defIds=" + ids.join(",");
        window.location.href = url;
    }
</script>
</html>